﻿using UnityEngine;
using System.Collections;

public class Spouse : MonoBehaviour {
	
	void Awake () 
	{
		m_player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
		m_property = GetComponent<HumanProperty> ();
		m_property.RandomProperty ();
		m_property.UpdateShow ();
	}

	void Start()
	{
		//m_property.RandomProperty ();
	}
	
	// Update is called once per frame
	void Update () 
	{
		if (Mathf.Abs(m_player.transform.position.x - this.transform.position.x) < 0.2f &&
		    Mathf.Abs(m_player.transform.position.y - this.transform.position.y) < 0.2f) 
		{
			//m_renderer.color = Color.red;
			//this.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);

			m_player.highlightedSpouse = this;
		}
		else
		{
			//m_renderer.color = Color.white;
			//this.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);

			if (m_player.highlightedSpouse == this)
			{
				m_player.highlightedSpouse = null;
			}
		}
	}

	private Player m_player;
	public HumanProperty m_property;
}
